﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace PlugNT.Cms.ActionLabel
{
    public class Enterprise
    {
        public static string ViewTxtList(int topcount, string where, string orderBy, int txtNum)
        {
            BLL.Enterprise bll = new BLL.Enterprise();
            StringBuilder strTxt = new StringBuilder();
            DataTable dt = bll.GetIdList(topcount, where, orderBy, "desc");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    strTxt.Append("<li>");
                    strTxt.Append("<a href=\"" + dr["name"].ToString() + "\" target=\"_blank\" class=\"f14\">");
                    strTxt.Append(PlugNT.Common.Utils.CutString(dr["name"].ToString(), 0, txtNum));
                    strTxt.Append("</a>");
                    strTxt.Append("</li>");
                }
            }
            else
            {
                strTxt.Append("<li>暂无数据显示...</li>");
            }
            return strTxt.ToString();
        }
        /// <summary>
        /// 首页企业广告
        /// </summary>
        /// <returns></returns>
        public static string ViewTxtList1(int topcount, string where, string orderBy, int txtNum)
        {
            BLL.Enterprise bll = new BLL.Enterprise();
            StringBuilder strTxt = new StringBuilder();
            DataTable dt = bll.GetIdList(topcount, where, orderBy, "desc");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    strTxt.Append("<span class=\"span150\">");
                    strTxt.Append("<a href=\"" + dr["name"].ToString() + "\">" + PlugNT.Common.Utils.CutString(dr["name"].ToString(), 0, txtNum) + "</a></span>");
                }
            }
            else
            {
                strTxt.Append("<span class=\"span150\">暂无数据显示...</span>");
            }
            return strTxt.ToString();
        }
    }

}
